#include <Date.au3>

Dim $pos0,$pos1,$Flag,$i,$j

AutoItSetOption ("TrayIconHide",1)
AutoItSetOption ("TrayAutoPause",0)

$pos0 = MouseGetPos()
$Flag = 0
For $i = 0 to 30
	For $j = 0 to 60
		Sleep(1000)
		$pos1 = MouseGetPos()
		if Abs(($pos1[0]-$pos0[0])) > 500  Then
			Run("shutdown -a")
			Exit
		EndIf
	Next
Next